package test;

/**
 * @Author Stringzhua
 * @Date 2024/6/28 17:43
 * description:
 */
public class test02 {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3, 4};
        int[] arr2 = {1, 2, 5, 6, 4, 3};
        int count = 0;
        for (int i = 0; i < arr1.length; i++) {
            for (int j = 0; j < arr2.length; j++) {
                if (arr1[i] == arr2[j]) {
                    count++;
                }
            }
        }
        if (count == 0) {
            System.out.println(-1);
        } else {
            System.out.println(count);
        }
    }
}
